package everydayGrade.t3;

import org.junit.jupiter.api.Test;

import java.util.Arrays;

/**
 * @Author: Siantar
 * @Date: 2023-08-01-21:21
 * @Description: 1.0
 */
public class T2681 {
    public int sumOfPower(int[] nums) {
        long dp = 0;
        long minSum = 0;
        int MOD = 1000000007;
        Arrays.sort(nums);
        for (int num : nums) {
            System.out.println(dp + " " + num + " " + minSum);
            dp = (dp + (long) num * num % MOD * (num + minSum)) % MOD;
            minSum = (2 * minSum + num) % MOD;
        }
        System.out.println(dp);
        return (int) dp;
    }

    @Test
    public void test() {
        System.out.println((int) (10e9 + 7));
    }
}
